/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.matrimonybeans;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.Stateless;

/**
 *
 * @author 4410s
 */
@Stateless
public class Delete_candidate implements Delete_candidateLocal {

    Connection conn;
    boolean flag;
    ResultSet rs = null;

    @Override
    public Boolean Delete_Candidate_Data(String username) {
        try {
            ConnectDB conDB = new ConnectDB();
            conn = conDB.getConnection();

            
            String strSql_Registration = " Delete Registration where username= ? ";
            PreparedStatement pstmt_Registration = conn.prepareCall(strSql_Registration);
            pstmt_Registration.setString(1, username);
            int count_Registration = 0;
            count_Registration = pstmt_Registration.executeUpdate();

            String strSql_SendRequest = " Delete SendRequest where username= ? ";
            PreparedStatement pstmt_SendRequest = conn.prepareCall(strSql_SendRequest);
            pstmt_SendRequest.setString(1, username);
            int count_SendRequest = 0;
            count_SendRequest = pstmt_SendRequest.executeUpdate();

            String strSql_ServicesDetails = " Delete ServicesDetails where username= ? ";
            PreparedStatement pstmt_ServicesDetails = conn.prepareCall(strSql_ServicesDetails);
            pstmt_ServicesDetails.setString(1, username);
            int count_ServicesDetails = 0;
            count_ServicesDetails = pstmt_ServicesDetails.executeUpdate();

            String strSql_candidate = " Delete Candidate  where username= ? ";
            PreparedStatement pstmt = conn.prepareCall(strSql_candidate);
            pstmt.setString(1, username);
            int count = 0;
            count = pstmt.executeUpdate();
            return true;

        } catch (SQLException ex) {
            Logger.getLogger(Delete_candidate.class.getName()).log(Level.SEVERE, null, ex);
        }
        return false;
    }
    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
}
